import 'package:flutter/material.dart';
import 'package:flutter_ahj_app/app/pctask/PcrwViewModel.dart';
import 'package:flutter_ahj_app/base/basewidget/view/BaseWidget.dart';
import 'package:flutter_ahj_app/base/utils/EmptyUtils.dart';
import 'package:flutter_ahj_app/base/utils/JUIKit/JText.dart';
import 'package:flutter_ahj_app/base/utils/ShowFiles/GetImageWidget.dart';
import 'package:flutter_ahj_app/base/utils/StringUtils.dart';
import 'package:flutter_ahj_app/base/utils/ToastUtils.dart';
import 'package:flutter_ahj_app/base/utils/mTopBar.dart';
import 'package:flutter_ahj_app/base/utils/video_player_page.dart';
import 'package:flutter_ahj_app/base/values/SQColor.dart';
import 'package:flutter_ahj_app/base/values/dimens.dart';
import 'package:flutter_ahj_app/base/widget/NoneData.dart';

class PcrwyhDetailView extends BaseStatefulWidget {
  final Map pcMap;
  PcrwyhDetailView({this.pcMap});

  @override
  State<StatefulWidget> initState() {
    // TODO: implement initState
    // throw UnimplementedError();
    return PcrwyhDetailViewState();
  }
}

class PcrwyhDetailViewState extends BaseState<PcrwViewModel, PcrwyhDetailView> {
  @override
  void initState() {
    // TODO: implement initState
    super.initState();

    Future.delayed(Duration.zero, () {
      _getData();
    });
  }

  @override
  Widget initWidget() {
    return Scaffold(
      backgroundColor: Color(0xfff4f5f6),
      appBar: MTopBar(
        elevation: 0,
        title: '隐患详情',
      ).create(),
      body: EmptyUtils.isForEmpty(_registerInfo) &&
              EmptyUtils.isForEmpty(_determineInfo) &&
              EmptyUtils.isForEmpty(_verifyInfo) &&
              EmptyUtils.isForEmpty(_rectifyInfo) &&
              EmptyUtils.isForEmpty(_acceptanceInfo)
          ? NoneData()
          : _bodyView(),
    );
  }

  _bodyView() {
    return SingleChildScrollView(
      child: Column(
        children: [
          EmptyUtils.isForEmpty(_registerInfo)
              ? Container(
                  margin: EdgeInsets.only(top: 15),
                )
              : Container(
                  margin: EdgeInsets.only(top: 15),
                  padding: EdgeInsets.fromLTRB(
                      Dimens.dimens10, 0, Dimens.dimens10, Dimens.dimens10),
                  child: Card(
                    elevation: 0,
                    child: Container(
                      child: Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          Container(
                            margin: EdgeInsets.all(15),
                            child: Column(
                              crossAxisAlignment: CrossAxisAlignment.start,
                              children: [
                                JText(
                                  "隐患登记信息",
                                  fontWeight: FontWeight.bold,
                                ),
                                Container(
                                  height: 1,
                                  width: double.infinity,
                                  color: SQColor.black_cecece,
                                  margin: EdgeInsets.only(top: Dimens.dimens16),
                                ),
                                SizedBox(
                                  height: 16,
                                ),
                                Column(
                                  crossAxisAlignment: CrossAxisAlignment.start,
                                  children: [
                                    _registerInfo[
                                                'hazardRectifyBeforeFileList'] ==
                                            null || _registerInfo['hazardRectifyBeforeFileList'].length == 0
                                        ? Container()
                                        : _imaeWidget(_registerInfo[
                                            'hazardRectifyBeforeFileList'], "整改前隐患视图："),
                                    Row(
                                      crossAxisAlignment:
                                          CrossAxisAlignment.start,
                                      children: [
                                        JText(
                                          "隐患名称：",
                                          color: SQColor.black_999999,
                                        ),
                                        Expanded(
                                          child: Container(
                                            padding: EdgeInsets.only(
                                                left: Dimens.dimens20),
                                            child: JText(
                                              StringUtils.getStr(
                                                  _registerInfo['hazardName']),
                                              textAlign: TextAlign.right,
                                              color: SQColor.black_999999,
                                              fontSize: 14,
                                            ),
                                          ),
                                        ),
                                      ],
                                    ),
                                    SizedBox(
                                      height: 10,
                                    ),
                                    Row(
                                      crossAxisAlignment:
                                          CrossAxisAlignment.start,
                                      children: [
                                        JText(
                                          "隐患描述：",
                                          color: SQColor.black_999999,
                                        ),
                                        Expanded(
                                          child: Container(
                                            padding: EdgeInsets.only(
                                                left: Dimens.dimens20),
                                            child: JText(
                                              StringUtils.getStr(
                                                  _registerInfo['description']),
                                              textAlign: TextAlign.right,
                                              color: SQColor.black_999999,
                                              fontSize: 14,
                                            ),
                                          ),
                                        ),
                                      ],
                                    ),
                                    SizedBox(
                                      height: 10,
                                    ),
                                    Row(
                                      crossAxisAlignment:
                                          CrossAxisAlignment.start,
                                      children: [
                                        JText(
                                          "隐患责任部门：",
                                          color: SQColor.black_999999,
                                        ),
                                        Expanded(
                                          child: Container(
                                            padding: EdgeInsets.only(
                                                left: Dimens.dimens20),
                                            child: JText(
                                              StringUtils.getStr(_registerInfo[
                                                  'riskPointOrgCodeName']),
                                              textAlign: TextAlign.right,
                                              color: SQColor.black_999999,
                                              fontSize: 14,
                                            ),
                                          ),
                                        ),
                                      ],
                                    ),
                                    SizedBox(
                                      height: 10,
                                    ),
                                    Row(
                                      crossAxisAlignment:
                                          CrossAxisAlignment.start,
                                      children: [
                                        JText(
                                          "隐患类别：",
                                          color: SQColor.black_999999,
                                        ),
                                        Expanded(
                                          child: Container(
                                            padding: EdgeInsets.only(
                                                left: Dimens.dimens20),
                                            child: JText(
                                              StringUtils.getStr(_registerInfo[
                                                  'hazardCategoryName']),
                                              textAlign: TextAlign.right,
                                              color: SQColor.black_999999,
                                              fontSize: 14,
                                            ),
                                          ),
                                        ),
                                      ],
                                    ),
                                    SizedBox(
                                      height: 10,
                                    ),
                                    Row(
                                      crossAxisAlignment:
                                          CrossAxisAlignment.start,
                                      children: [
                                        JText(
                                          "隐患等级：",
                                          color: SQColor.black_999999,
                                        ),
                                        Expanded(
                                          child: Container(
                                            padding: EdgeInsets.only(
                                                left: Dimens.dimens20),
                                            child: JText(
                                              StringUtils.getStr(_registerInfo[
                                                  'hazardRegisterLevelName']),
                                              textAlign: TextAlign.right,
                                              color: SQColor.black_999999,
                                              fontSize: 14,
                                            ),
                                          ),
                                        ),
                                      ],
                                    ),
                                    SizedBox(
                                      height: 10,
                                    ),
                                    Row(
                                      crossAxisAlignment:
                                          CrossAxisAlignment.start,
                                      children: [
                                        JText(
                                          "隐患所在场所/位置：",
                                          color: SQColor.black_999999,
                                        ),
                                        Expanded(
                                          child: Container(
                                            padding: EdgeInsets.only(
                                                left: Dimens.dimens20),
                                            child: JText(
                                              StringUtils.getStr(_registerInfo[
                                                  'riskPointDistrictName']),
                                              textAlign: TextAlign.right,
                                              color: SQColor.black_999999,
                                              fontSize: 14,
                                            ),
                                          ),
                                        ),
                                      ],
                                    ),
                                    SizedBox(
                                      height: 10,
                                    ),
                                    Row(
                                      crossAxisAlignment:
                                          CrossAxisAlignment.start,
                                      children: [
                                        JText(
                                          "隐患核查人：",
                                          color: SQColor.black_999999,
                                        ),
                                        Expanded(
                                          child: Container(
                                            padding: EdgeInsets.only(
                                                left: Dimens.dimens20),
                                            child: JText(
                                              StringUtils.getStr(_registerInfo[
                                                  'verifierName']),
                                              textAlign: TextAlign.right,
                                              color: SQColor.black_999999,
                                              fontSize: 14,
                                            ),
                                          ),
                                        ),
                                      ],
                                    ),
                                    SizedBox(
                                      height: 10,
                                    ),
                                    Row(
                                      crossAxisAlignment:
                                          CrossAxisAlignment.start,
                                      children: [
                                        JText(
                                          "登记人：",
                                          color: SQColor.black_999999,
                                        ),
                                        Expanded(
                                          child: Container(
                                            padding: EdgeInsets.only(
                                                left: Dimens.dimens20),
                                            child: JText(
                                              StringUtils.getStr(_registerInfo[
                                                  'createUserName']),
                                              textAlign: TextAlign.right,
                                              color: SQColor.black_999999,
                                              fontSize: 14,
                                            ),
                                          ),
                                        ),
                                      ],
                                    ),
                                    SizedBox(
                                      height: 10,
                                    ),
                                    Row(
                                      crossAxisAlignment:
                                          CrossAxisAlignment.start,
                                      children: [
                                        JText(
                                          "登记时间：",
                                          color: SQColor.black_999999,
                                        ),
                                        Expanded(
                                          child: Container(
                                            padding: EdgeInsets.only(
                                                left: Dimens.dimens20),
                                            child: JText(
                                              StringUtils.getStr(
                                                  _registerInfo['submitTime']),
                                              textAlign: TextAlign.right,
                                              color: SQColor.black_999999,
                                              fontSize: 14,
                                            ),
                                          ),
                                        ),
                                      ],
                                    ),
                                    SizedBox(
                                      height: 10,
                                    ),
                                    Row(
                                      crossAxisAlignment:
                                          CrossAxisAlignment.start,
                                      children: [
                                        JText(
                                          "创建时间：",
                                          color: SQColor.black_999999,
                                        ),
                                        Expanded(
                                          child: Container(
                                            padding: EdgeInsets.only(
                                                left: Dimens.dimens20),
                                            child: JText(
                                              StringUtils.getStr(
                                                  _registerInfo['createTime']),
                                              textAlign: TextAlign.right,
                                              color: SQColor.black_999999,
                                              fontSize: 14,
                                            ),
                                          ),
                                        ),
                                      ],
                                    ),
                                  ],
                                ),
                              ],
                            ),
                          ),
                        ],
                      ),
                    ),
                  ),
                ),
          EmptyUtils.isForEmpty(_determineInfo)
              ? Container(
                  margin: EdgeInsets.only(top: 15),
                )
              : Container(
                  padding: EdgeInsets.fromLTRB(
                      Dimens.dimens10, 0, Dimens.dimens10, Dimens.dimens10),
                  child: Card(
                    elevation: 0,
                    child: Container(
                      child: Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          Container(
                            margin: EdgeInsets.all(15),
                            child: Column(
                              crossAxisAlignment: CrossAxisAlignment.start,
                              children: [
                                JText(
                                  "隐患判定信息",
                                  fontWeight: FontWeight.bold,
                                ),
                                Container(
                                  height: 1,
                                  width: double.infinity,
                                  color: SQColor.black_cecece,
                                  margin: EdgeInsets.only(top: Dimens.dimens16),
                                ),
                                SizedBox(
                                  height: 16,
                                ),
                                Column(
                                  crossAxisAlignment: CrossAxisAlignment.start,
                                  children: [
                                    Row(
                                      crossAxisAlignment:
                                          CrossAxisAlignment.start,
                                      children: [
                                        JText(
                                          "判定结果：",
                                          color: SQColor.black_999999,
                                        ),
                                        Expanded(
                                          child: Container(
                                            padding: EdgeInsets.only(
                                                left: Dimens.dimens20),
                                            child: JText(
                                              StringUtils.getStr(_determineInfo[
                                                  'determineResultTypeName']),
                                              textAlign: TextAlign.right,
                                              color: SQColor.black_999999,
                                              fontSize: 14,
                                            ),
                                          ),
                                        ),
                                      ],
                                    ),
                                    SizedBox(
                                      height: 10,
                                    ),
                                    Row(
                                      crossAxisAlignment:
                                          CrossAxisAlignment.start,
                                      children: [
                                        JText(
                                          "判定结果说明：",
                                          color: SQColor.black_999999,
                                        ),
                                        Expanded(
                                          child: Container(
                                            padding: EdgeInsets.only(
                                                left: Dimens.dimens20),
                                            child: JText(
                                              StringUtils.getStr(_determineInfo[
                                                  'determineResultDescription']),
                                              textAlign: TextAlign.right,
                                              color: SQColor.black_999999,
                                              fontSize: 14,
                                            ),
                                          ),
                                        ),
                                      ],
                                    ),
                                    SizedBox(
                                      height: 10,
                                    ),
                                    Row(
                                      crossAxisAlignment:
                                          CrossAxisAlignment.start,
                                      children: [
                                        JText(
                                          "判定人：",
                                          color: SQColor.black_999999,
                                        ),
                                        Expanded(
                                          child: Container(
                                            padding: EdgeInsets.only(
                                                left: Dimens.dimens20),
                                            child: JText(
                                              StringUtils.getStr(_determineInfo[
                                                  'deciderName']),
                                              textAlign: TextAlign.right,
                                              color: SQColor.black_999999,
                                              fontSize: 14,
                                            ),
                                          ),
                                        ),
                                      ],
                                    ),
                                    SizedBox(
                                      height: 10,
                                    ),
                                    Row(
                                      crossAxisAlignment:
                                          CrossAxisAlignment.start,
                                      children: [
                                        JText(
                                          "判定时间：",
                                          color: SQColor.black_999999,
                                        ),
                                        Expanded(
                                          child: Container(
                                            padding: EdgeInsets.only(
                                                left: Dimens.dimens20),
                                            child: JText(
                                              StringUtils.getStr(_determineInfo[
                                                  'determineTime']),
                                              textAlign: TextAlign.right,
                                              color: SQColor.black_999999,
                                              fontSize: 14,
                                            ),
                                          ),
                                        ),
                                      ],
                                    ),
                                    SizedBox(
                                      height: 10,
                                    ),
                                    Row(
                                      crossAxisAlignment:
                                          CrossAxisAlignment.start,
                                      children: [
                                        JText(
                                          "所属风险点：",
                                          color: SQColor.black_999999,
                                        ),
                                        Expanded(
                                          child: Container(
                                            padding: EdgeInsets.only(
                                                left: Dimens.dimens20),
                                            child: JText(
                                              StringUtils.getStr(_determineInfo[
                                                  'riskPointName']),
                                              textAlign: TextAlign.right,
                                              color: SQColor.black_999999,
                                              fontSize: 14,
                                            ),
                                          ),
                                        ),
                                      ],
                                    ),
                                    SizedBox(
                                      height: 10,
                                    ),
                                    Row(
                                      crossAxisAlignment:
                                          CrossAxisAlignment.start,
                                      children: [
                                        JText(
                                          "所属危险源：",
                                          color: SQColor.black_999999,
                                        ),
                                        Expanded(
                                          child: Container(
                                            padding: EdgeInsets.only(
                                                left: Dimens.dimens20),
                                            child: JText(
                                              StringUtils.getStr(_determineInfo[
                                                  'dangerSourceName']),
                                              textAlign: TextAlign.right,
                                              color: SQColor.black_999999,
                                              fontSize: 14,
                                            ),
                                          ),
                                        ),
                                      ],
                                    ),
                                    SizedBox(
                                      height: 10,
                                    ),
                                    Row(
                                      crossAxisAlignment:
                                          CrossAxisAlignment.start,
                                      children: [
                                        JText(
                                          "隐患地点：",
                                          color: SQColor.black_999999,
                                        ),
                                        Expanded(
                                          child: Container(
                                            padding: EdgeInsets.only(
                                                left: Dimens.dimens20),
                                            child: JText(
                                              StringUtils.getStr(_determineInfo[
                                                  'riskPointDistrictName']),
                                              textAlign: TextAlign.right,
                                              color: SQColor.black_999999,
                                              fontSize: 14,
                                            ),
                                          ),
                                        ),
                                      ],
                                    ),
                                    SizedBox(
                                      height: 10,
                                    ),
                                    Row(
                                      crossAxisAlignment:
                                          CrossAxisAlignment.start,
                                      children: [
                                        JText(
                                          "隐患责任部门：",
                                          color: SQColor.black_999999,
                                        ),
                                        Expanded(
                                          child: Container(
                                            padding: EdgeInsets.only(
                                                left: Dimens.dimens20),
                                            child: JText(
                                              StringUtils.getStr(_determineInfo[
                                                  'riskPointOrgCodeName']),
                                              textAlign: TextAlign.right,
                                              color: SQColor.black_999999,
                                              fontSize: 14,
                                            ),
                                          ),
                                        ),
                                      ],
                                    ),
                                    SizedBox(
                                      height: 10,
                                    ),
                                    Row(
                                      crossAxisAlignment:
                                          CrossAxisAlignment.start,
                                      children: [
                                        JText(
                                          "隐患类别：",
                                          color: SQColor.black_999999,
                                        ),
                                        Expanded(
                                          child: Container(
                                            padding: EdgeInsets.only(
                                                left: Dimens.dimens20),
                                            child: JText(
                                              StringUtils.getStr(_determineInfo[
                                                  'hazardCategoryName']),
                                              textAlign: TextAlign.right,
                                              color: SQColor.black_999999,
                                              fontSize: 14,
                                            ),
                                          ),
                                        ),
                                      ],
                                    ),
                                    SizedBox(
                                      height: 10,
                                    ),
                                    Row(
                                      crossAxisAlignment:
                                          CrossAxisAlignment.start,
                                      children: [
                                        JText(
                                          "隐患等级：",
                                          color: SQColor.black_999999,
                                        ),
                                        Expanded(
                                          child: Container(
                                            padding: EdgeInsets.only(
                                                left: Dimens.dimens20),
                                            child: JText(
                                              StringUtils.getStr(_determineInfo[
                                                  'hazardCategoryName']),
                                              textAlign: TextAlign.right,
                                              color: SQColor.black_999999,
                                              fontSize: 14,
                                            ),
                                          ),
                                        ),
                                      ],
                                    ),
                                  ],
                                ),
                              ],
                            ),
                          ),
                        ],
                      ),
                    ),
                  ),
                ),
          EmptyUtils.isForEmpty(_verifyInfo)
              ? Container(
                  margin: EdgeInsets.only(top: 15),
                )
              : Container(
                  padding: EdgeInsets.fromLTRB(
                      Dimens.dimens10, 0, Dimens.dimens10, Dimens.dimens10),
                  child: Card(
                    elevation: 0,
                    child: Container(
                      child: Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          Container(
                            margin: EdgeInsets.all(15),
                            child: Column(
                              crossAxisAlignment: CrossAxisAlignment.start,
                              children: [
                                JText(
                                  "隐患核查信息",
                                  fontWeight: FontWeight.bold,
                                ),
                                Container(
                                  height: 1,
                                  width: double.infinity,
                                  color: SQColor.black_cecece,
                                  margin: EdgeInsets.only(top: Dimens.dimens16),
                                ),
                                SizedBox(
                                  height: 16,
                                ),
                                Column(
                                  crossAxisAlignment: CrossAxisAlignment.start,
                                  children: [
                                    Row(
                                      crossAxisAlignment:
                                          CrossAxisAlignment.start,
                                      children: [
                                        JText(
                                          "隐患核查结果：",
                                          color: SQColor.black_999999,
                                        ),
                                        Expanded(
                                          child: Container(
                                            padding: EdgeInsets.only(
                                                left: Dimens.dimens20),
                                            child: JText(
                                              StringUtils.getStr(_verifyInfo[
                                                  'verifyResultTypeName']),
                                              textAlign: TextAlign.right,
                                              color: SQColor.black_999999,
                                              fontSize: 14,
                                            ),
                                          ),
                                        ),
                                      ],
                                    ),
                                    SizedBox(
                                      height: 10,
                                    ),
                                    Row(
                                      crossAxisAlignment:
                                          CrossAxisAlignment.start,
                                      children: [
                                        JText(
                                          "隐患核查意见：",
                                          color: SQColor.black_999999,
                                        ),
                                        Expanded(
                                          child: Container(
                                            padding: EdgeInsets.only(
                                                left: Dimens.dimens20),
                                            child: JText(
                                              StringUtils.getStr(_verifyInfo[
                                                  'verifyOpinionDescription']),
                                              textAlign: TextAlign.right,
                                              color: SQColor.black_999999,
                                              fontSize: 14,
                                            ),
                                          ),
                                        ),
                                      ],
                                    ),
                                    SizedBox(
                                      height: 10,
                                    ),
                                    Row(
                                      crossAxisAlignment:
                                          CrossAxisAlignment.start,
                                      children: [
                                        JText(
                                          "隐患归属专业：",
                                          color: SQColor.black_999999,
                                        ),
                                        Expanded(
                                          child: Container(
                                            padding: EdgeInsets.only(
                                                left: Dimens.dimens20),
                                            child: JText(
                                              StringUtils.getStr(_verifyInfo[
                                                  'hazardProfessionName']),
                                              textAlign: TextAlign.right,
                                              color: SQColor.black_999999,
                                              fontSize: 14,
                                            ),
                                          ),
                                        ),
                                      ],
                                    ),
                                    SizedBox(
                                      height: 10,
                                    ),
                                    Row(
                                      crossAxisAlignment:
                                          CrossAxisAlignment.start,
                                      children: [
                                        JText(
                                          "简要原因分析：",
                                          color: SQColor.black_999999,
                                        ),
                                        Expanded(
                                          child: Container(
                                            padding: EdgeInsets.only(
                                                left: Dimens.dimens20),
                                            child: JText(
                                              StringUtils.getStr(_verifyInfo[
                                                  'reasonAnalyzeDescription']),
                                              textAlign: TextAlign.right,
                                              color: SQColor.black_999999,
                                              fontSize: 14,
                                            ),
                                          ),
                                        ),
                                      ],
                                    ),
                                    SizedBox(
                                      height: 10,
                                    ),
                                    Row(
                                      crossAxisAlignment:
                                          CrossAxisAlignment.start,
                                      children: [
                                        JText(
                                          "隐患治理措施：",
                                          color: SQColor.black_999999,
                                        ),
                                        Expanded(
                                          child: Container(
                                            padding: EdgeInsets.only(
                                                left: Dimens.dimens20),
                                            child: JText(
                                              StringUtils.getStr(_verifyInfo[
                                                  'hazardGovernMeasure']),
                                              textAlign: TextAlign.right,
                                              color: SQColor.black_999999,
                                              fontSize: 14,
                                            ),
                                          ),
                                        ),
                                      ],
                                    ),
                                    SizedBox(
                                      height: 10,
                                    ),
                                    Row(
                                      crossAxisAlignment:
                                          CrossAxisAlignment.start,
                                      children: [
                                        JText(
                                          "隐患整改责任人：",
                                          color: SQColor.black_999999,
                                        ),
                                        Expanded(
                                          child: Container(
                                            padding: EdgeInsets.only(
                                                left: Dimens.dimens20),
                                            child: JText(
                                              StringUtils.getStr(_verifyInfo[
                                                  'rectifyResponsiblePersonName']),
                                              textAlign: TextAlign.right,
                                              color: SQColor.black_999999,
                                              fontSize: 14,
                                            ),
                                          ),
                                        ),
                                      ],
                                    ),
                                    SizedBox(
                                      height: 10,
                                    ),
                                    Row(
                                      crossAxisAlignment:
                                          CrossAxisAlignment.start,
                                      children: [
                                        JText(
                                          "隐患整改责任部门：",
                                          color: SQColor.black_999999,
                                        ),
                                        Expanded(
                                          child: Container(
                                            padding: EdgeInsets.only(
                                                left: Dimens.dimens20),
                                            child: JText(
                                              StringUtils.getStr(_verifyInfo[
                                                  'rectifyResponsibleOrgCodeName']),
                                              textAlign: TextAlign.right,
                                              color: SQColor.black_999999,
                                              fontSize: 14,
                                            ),
                                          ),
                                        ),
                                      ],
                                    ),
                                    SizedBox(
                                      height: 10,
                                    ),
                                    Row(
                                      crossAxisAlignment:
                                          CrossAxisAlignment.start,
                                      children: [
                                        JText(
                                          "整改类型：",
                                          color: SQColor.black_999999,
                                        ),
                                        Expanded(
                                          child: Container(
                                            padding: EdgeInsets.only(
                                                left: Dimens.dimens20),
                                            child: JText(
                                              StringUtils.getStr(_verifyInfo[
                                                  'rectifyTypeName']),
                                              textAlign: TextAlign.right,
                                              color: SQColor.black_999999,
                                              fontSize: 14,
                                            ),
                                          ),
                                        ),
                                      ],
                                    ),
                                    SizedBox(
                                      height: 10,
                                    ),
                                    Row(
                                      crossAxisAlignment:
                                          CrossAxisAlignment.start,
                                      children: [
                                        JText(
                                          "整改期限：",
                                          color: SQColor.black_999999,
                                        ),
                                        Expanded(
                                          child: Container(
                                            padding: EdgeInsets.only(
                                                left: Dimens.dimens20),
                                            child: JText(
                                              StringUtils.getStr(_verifyInfo[
                                                  'rectifyCompleteDeadlineTime']),
                                              textAlign: TextAlign.right,
                                              color: SQColor.black_999999,
                                              fontSize: 14,
                                            ),
                                          ),
                                        ),
                                      ],
                                    ),
                                  ],
                                ),
                              ],
                            ),
                          ),
                        ],
                      ),
                    ),
                  ),
                ),
          EmptyUtils.isForEmpty(_rectifyInfo)
              ? Container(
                  margin: EdgeInsets.only(top: 15),
                )
              : Container(
                  padding: EdgeInsets.fromLTRB(
                      Dimens.dimens10, 0, Dimens.dimens10, Dimens.dimens10),
                  child: Card(
                    elevation: 0,
                    child: Container(
                      child: Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          Container(
                            margin: EdgeInsets.all(15),
                            child: Column(
                              crossAxisAlignment: CrossAxisAlignment.start,
                              children: [
                                JText(
                                  "隐患整改信息",
                                  fontWeight: FontWeight.bold,
                                ),
                                Container(
                                  height: 1,
                                  width: double.infinity,
                                  color: SQColor.black_cecece,
                                  margin: EdgeInsets.only(top: Dimens.dimens16),
                                ),
                                SizedBox(
                                  height: 16,
                                ),
                                Column(
                                  crossAxisAlignment: CrossAxisAlignment.start,
                                  children: [
                                    Row(
                                      crossAxisAlignment:
                                          CrossAxisAlignment.start,
                                      children: [
                                        JText(
                                          "隐患整改措施：",
                                          color: SQColor.black_999999,
                                        ),
                                        Expanded(
                                          child: Container(
                                            padding: EdgeInsets.only(
                                                left: Dimens.dimens20),
                                            child: JText(
                                              StringUtils.getStr(_rectifyInfo[
                                                  'rectifyMeasure']),
                                              textAlign: TextAlign.right,
                                              color: SQColor.black_999999,
                                              fontSize: 14,
                                            ),
                                          ),
                                        ),
                                      ],
                                    ),
                                    SizedBox(
                                      height: 10,
                                    ),
                                    Row(
                                      crossAxisAlignment:
                                          CrossAxisAlignment.start,
                                      children: [
                                        JText(
                                          "隐患整改资金（元）：",
                                          color: SQColor.black_999999,
                                        ),
                                        Expanded(
                                          child: Container(
                                            padding: EdgeInsets.only(
                                                left: Dimens.dimens20),
                                            child: JText(
                                              StringUtils.getStr(_rectifyInfo[
                                                          'rectifyMoney']
                                                      .toString()) +
                                                  '元',
                                              textAlign: TextAlign.right,
                                              color: SQColor.black_999999,
                                              fontSize: 14,
                                            ),
                                          ),
                                        ),
                                      ],
                                    ),
                                    SizedBox(
                                      height: 10,
                                    ),
                                    Row(
                                      crossAxisAlignment:
                                          CrossAxisAlignment.start,
                                      children: [
                                        JText(
                                          "隐患整改负责人：",
                                          color: SQColor.black_999999,
                                        ),
                                        Expanded(
                                          child: Container(
                                            padding: EdgeInsets.only(
                                                left: Dimens.dimens20),
                                            child: JText(
                                              StringUtils.getStr(_rectifyInfo[
                                                  'rectifyResponsiblePersonName']),
                                              textAlign: TextAlign.right,
                                              color: SQColor.black_999999,
                                              fontSize: 14,
                                            ),
                                          ),
                                        ),
                                      ],
                                    ),
                                    SizedBox(
                                      height: 10,
                                    ),
                                    Row(
                                      crossAxisAlignment:
                                          CrossAxisAlignment.start,
                                      children: [
                                        JText(
                                          "隐患整改责任部门：",
                                          color: SQColor.black_999999,
                                        ),
                                        Expanded(
                                          child: Container(
                                            padding: EdgeInsets.only(
                                                left: Dimens.dimens20),
                                            child: JText(
                                              StringUtils.getStr(_rectifyInfo[
                                                  'rectifyResponsibleOrgCodeName']),
                                              textAlign: TextAlign.right,
                                              color: SQColor.black_999999,
                                              fontSize: 14,
                                            ),
                                          ),
                                        ),
                                      ],
                                    ),
                                    SizedBox(
                                      height: 10,
                                    ),
                                    Row(
                                      crossAxisAlignment:
                                          CrossAxisAlignment.start,
                                      children: [
                                        JText(
                                          "整改完成时间：",
                                          color: SQColor.black_999999,
                                        ),
                                        Expanded(
                                          child: Container(
                                            padding: EdgeInsets.only(
                                                left: Dimens.dimens20),
                                            child: JText(
                                              StringUtils.getStr(_rectifyInfo[
                                                  'rectifyCompleteTime']),
                                              textAlign: TextAlign.right,
                                              color: SQColor.black_999999,
                                              fontSize: 14,
                                            ),
                                          ),
                                        ),
                                      ],
                                    ),
                                    SizedBox(
                                      height: 10,
                                    ),
                                    _rectifyInfo['hazardRectifyAfterFileList'] ==
                                                    null || _rectifyInfo['hazardRectifyAfterFileList'].length == 0
                                                ? Container()
                                                : _imaeWidget(
                                                    _rectifyInfo[
                                                        'hazardRectifyAfterFileList'],
                                                    "整改后的隐患视图："),
                                    Row(
                                      crossAxisAlignment:
                                          CrossAxisAlignment.start,
                                      children: [
                                        JText(
                                          "隐患整改情况：",
                                          color: SQColor.black_999999,
                                        ),
                                        Expanded(
                                          child: Container(
                                            padding: EdgeInsets.only(
                                                left: Dimens.dimens20),
                                            child: JText(
                                              StringUtils.getStr(_rectifyInfo[
                                                  'rectifyDescription']),
                                              textAlign: TextAlign.right,
                                              color: SQColor.black_999999,
                                              fontSize: 14,
                                            ),
                                          ),
                                        ),
                                      ],
                                    ),
                                  ],
                                ),
                              ],
                            ),
                          ),
                        ],
                      ),
                    ),
                  ),
                ),
          EmptyUtils.isForEmpty(_acceptanceInfo)
              ? Container(
                  margin: EdgeInsets.only(top: 15),
                )
              : Container(
                  padding: EdgeInsets.fromLTRB(
                      Dimens.dimens10, 0, Dimens.dimens10, Dimens.dimens10),
                  child: Card(
                    elevation: 0,
                    child: Container(
                      child: Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          Container(
                            margin: EdgeInsets.all(15),
                            child: Column(
                              crossAxisAlignment: CrossAxisAlignment.start,
                              children: [
                                JText(
                                  "隐患验收信息",
                                  fontWeight: FontWeight.bold,
                                ),
                                Container(
                                  height: 1,
                                  width: double.infinity,
                                  color: SQColor.black_cecece,
                                  margin: EdgeInsets.only(top: Dimens.dimens16),
                                ),
                                SizedBox(
                                  height: 16,
                                ),
                                Column(
                                  crossAxisAlignment: CrossAxisAlignment.start,
                                  children: [
                                    Row(
                                      crossAxisAlignment:
                                          CrossAxisAlignment.start,
                                      children: [
                                        JText(
                                          "隐患验收人：",
                                          color: SQColor.black_999999,
                                        ),
                                        Expanded(
                                          child: Container(
                                            padding: EdgeInsets.only(
                                                left: Dimens.dimens20),
                                            child: JText(
                                              StringUtils.getStr(
                                                  _acceptanceInfo[
                                                      'acceptorName']),
                                              textAlign: TextAlign.right,
                                              color: SQColor.black_999999,
                                              fontSize: 14,
                                            ),
                                          ),
                                        ),
                                      ],
                                    ),
                                    SizedBox(
                                      height: 10,
                                    ),
                                    Row(
                                      crossAxisAlignment:
                                          CrossAxisAlignment.start,
                                      children: [
                                        JText(
                                          "验收结果：",
                                          color: SQColor.black_999999,
                                        ),
                                        Expanded(
                                          child: Container(
                                            padding: EdgeInsets.only(
                                                left: Dimens.dimens20),
                                            child: JText(
                                              StringUtils.getStr(_acceptanceInfo[
                                                  'acceptanceResultTypeName']),
                                              textAlign: TextAlign.right,
                                              color: SQColor.black_999999,
                                              fontSize: 14,
                                            ),
                                          ),
                                        ),
                                      ],
                                    ),
                                    SizedBox(
                                      height: 10,
                                    ),
                                    Row(
                                      crossAxisAlignment:
                                          CrossAxisAlignment.start,
                                      children: [
                                        JText(
                                          "验收情况说明：",
                                          color: SQColor.black_999999,
                                        ),
                                        Expanded(
                                          child: Container(
                                            padding: EdgeInsets.only(
                                                left: Dimens.dimens20),
                                            child: JText(
                                              StringUtils.getStr(
                                                  _acceptanceInfo[
                                                      'acceptanceDescription']),
                                              textAlign: TextAlign.right,
                                              color: SQColor.black_999999,
                                              fontSize: 14,
                                            ),
                                          ),
                                        ),
                                      ],
                                    ),
                                    SizedBox(
                                      height: 10,
                                    ),
                                    _acceptanceInfo['acceptanceFileList'] ==
                                        null || _acceptanceInfo['acceptanceFileList'].length == 0
                                        ? Container()
                                        : _imaeWidget(
                                        _acceptanceInfo[
                                        'acceptanceFileList'],
                                        "验收附件："),
                                  ],
                                ),
                              ],
                            ),
                          ),
                        ],
                      ),
                    ),
                  ),
                ),
        ],
      ),
    );
  }

  _imaeWidget(var list, var title) {
    List filePath = [];
    for (var i = 0; i < list.length; i++) {
      filePath.add(list[i]['url']);
    }
    return Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        JText(
          title,
          color: SQColor.black_999999,
        ),
        Container(
          height: 10,
        ),
        GridView.builder(
            padding: EdgeInsets.zero,
            physics: const NeverScrollableScrollPhysics(),
            shrinkWrap: true,
            gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
                crossAxisCount: 4, //每行三列
                childAspectRatio: 1 //显示区域宽高相等
                ),
            itemCount: list.length,
            itemBuilder: (context, index) {
              return GestureDetector(
                  onTap: () {
                    print(filePath);
                    if (filePath[index].contains("mp4")) {
                      Navigator.push(
                          context,
                          MaterialPageRoute(
                              builder: (context) => VideoPlayerPage(
                                    videoPath: filePath[index],
                                    videoSource: "1",
                                  )));
                    } else {
                      List<String> filePath1 = [];
                      int position = 0;
                      for (int i = 0; i < filePath.length; i++) {
                        if (!filePath[i].contains(".mp4")) {
                          filePath1.add(filePath[i]);
                        }
                      }
                      for (int i = 0; i < filePath1.length; i++) {
                        if (filePath1[i] == filePath[index]) {
                          position = i;
                        }
                      }
                      Navigator.pushNamed(context, "/ShowImage", arguments: {
                        'position': position,
                        'filePath': filePath1
                      });
                    }
                  },
                  child: Column(
                    children: [
                      Expanded(
                        child: ImageWidget(
                        fileName: list[index]['url'],
                      ),
                      ),
                      Container(
                        height: 10,
                      ),
                    ],
                  ));
            }),
        Container(
          height: 10,
        ),
      ],
    );
  }

  var _registerInfo; //登记信息
  var _determineInfo; //判定信息
  var _verifyInfo; //核查信息
  var _rectifyInfo; //整改信息
  var _acceptanceInfo; //验收信息

  ///获得数据
  _getData() async {
    var map = {
      'hazardInvestigationTaskId':
          StringUtils.getStr(widget.pcMap['hazardInvestigationTaskId']),
      'hazardInvestigationRiskPointId':
          StringUtils.getStr(widget.pcMap['hazardInvestigationRiskPointId']),
      'hazardInvestigationContentId':
          StringUtils.getStr(widget.pcMap['hazardInvestigationContentId']),
    };
    viewModel.getpcyhDetails(map);
    viewModel.getpcyhDetailsStream().listen((result) {
      print(result);
      if (result['code'] == "0") {
        setState(() {
          _registerInfo = result['data']['registerInfo'];
          _determineInfo = result['data']['determineInfo'];
          _verifyInfo = result['data']['verifyInfo'];
          _rectifyInfo = result['data']['rectifyInfo'];
          _acceptanceInfo = result['data']['acceptanceInfo'];
        });
      } else {
        ToastUtils.showToast(result['msg']);
      }
    });
  }
}
